<?php
	include '../init.php';
	
	//分页
	// if (isset($_GET['page'])&&$_GET['page']>0) {
	// 	$page=$_GET['page'];
	// }else{
	// 	$page=1;
	// }

	// $sql = "SELECT count(*) FROM category";
	// $count = $mysql->getOne($sql);
	// $limit = 5;
	// $p = new MyPage($count,$limit,$page);
	// $pageHtml = $p->render();

	// $start = ($page-1)*$limit;
	// $sql = "SELECT * FROM category limit {$start},{$limit}";
	// $result = $mysql -> getAll($sql); 
	
	//get跳转
	// if (isset($_POST['find'])) {
	// 	header("location:../article/index.php?seek=".$_POST['seek']."&find=".$_POST['find']." ");
	// }
	$categoryList=getCategoryList();
?>
<!DOCTYPE html>
<html>
<head>
	<title>分类列表</title>
	<meta charset="utf-8">
	<script type="text/javascript" src="http://libs.baidu.com/jquery/1.9.1/jquery.js"></script>
		<!-- 最新版本的 Bootstrap 核心 CSS 文件 -->
	<link rel="stylesheet" href="https://cdn.bootcss.com/bootstrap/3.3.7/css/bootstrap.min.css" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous">

	<!-- 可选的 Bootstrap 主题文件（一般不用引入） -->
	<!-- <link rel="stylesheet" href="https://cdn.bootcss.com/bootstrap/3.3.7/css/bootstrap-theme.min.css" integrity="sha384-rHyoN1iRsVXV4nD0JutlnGaslCJuC7uwjduW9SVrLvRYooPp2bWYgmgJQIXwl/Sp" crossorigin="anonymous"> -->
	
	<!-- 最新的 Bootstrap 核心 JavaScript 文件 -->
	<script src="https://cdn.bootcss.com/bootstrap/3.3.7/js/bootstrap.min.js" integrity="sha384-Tc5IQib027qvyjSMfHjOMaLkfuWVxZxUPnCJA7l2mCWNIpG9mGCD8wGNIcPD7Txa" crossorigin="anonymous"></script>
	<style type="text/css">
	</style>
</head>
<body background="../../public/img/bg4.jpg">
		<div>&nbsp;</div>
		<div>&nbsp;</div>
	<div class="container bg-info">
		<div class="col-md-12">&nbsp;</div>
		<div class="col-md-12">&nbsp;</div>
		<div class="row">
			<?php include '../nav.php'; ?>
			<div class="col-md-12">&nbsp;</div>
			<div class="col-md-12">&nbsp;</div>
		</div>
		
	</div>
	<div class="container bg-info">
		<div class="col-md-12">&nbsp;</div>
		<div class="col-md-12">&nbsp;</div>
		<div class="panel panel-default">
		  <!-- Default panel contents -->
		  <div class="panel-heading" style="padding-left: 20px;font-size: 18px;height: 25px;line-height: 25px;"><span class="glyphicon glyphicon-th-list"></span>分类列表&nbsp;&nbsp;&nbsp;
		  	<a class="btn btn-success" href="form.php">添加新分类</a>
		  	<div class="col-md-12">&nbsp;</div>
		  </div>

		  <!-- Table -->
		  <table class="table">
		  		
				<div class="col-md-12">&nbsp;</div>
		    	<thead class="text-center">
					<tr>
						<th class="text-center">id</th>
						<th class="text-center">分类名称</th>
						<th class="text-center">查看文章</th>
						<th class="text-center">编辑</th>
						<th class="text-center" onclick="return cate_delete()">删除</th>
					</tr>
				</thead>
				<tbody class="text-center">
					<?php echo $categoryList; ?>
				</tbody>
		  </table>
		 
		</div>
		<script type="text/javascript">
			function cate_delete(){
				if (confirm("确认要删除这个分类名吗？")) {
					return true;
				}else{
					return false;
				}
			}
		</script>
	</div>
	<div>&nbsp;</div>
</body>
</html>
